<% layout('/layouts/default.html', {title: '', libs: ['dataGrid']}){ %>
<!-- <link rel="stylesheet" href="${ctxStatic}/modules/sys/sysDesktop.css?${_version}"> -->
<style>
    *{
        margin:0px;
        padding:0px
    }
    p{
        margin:0px
    }
    .workKey {
        border-radius: 4px;
        margin: 0 0 15px 0;
        text-align: center;
        background: #fff;
        -webkit-transition: -webkit-transform .3s;
        transition: -webkit-transform .3s;
        transition: transform .3s;
        transition: transform .3s,-webkit-transform .3s;
        padding: 0 24px;
        -webkit-box-sizing: border-box;
        box-sizing: border-box;
        padding-bottom: 15px;
        position: relative;
    }
    .active {
        color: #4b87ff;
    }
    .huls span {
        padding-left: 10px;
        font-size: 14px;
        cursor: pointer;
    }
    .huizong{
        display: -webkit-box;
        display: -ms-flexbox;
        display: flex;
        -ms-flex-pack: distribute;
        justify-content: space-around;
    }
    .huizong p{
        border-radius: 4px;
        text-align: center;
        height: 110px;
        -webkit-box-flex: 1;
        -ms-flex: 1;
        flex: 1;
        margin-right: 35px;
        cursor: pointer;
    }
    .huizong p span{
        display: block;
        color: #fff;
        font-size: 18px;
        padding-top: 20px;
    }
    .huizong p:last-child {
        margin-right: 0;
    }
    .workKey .shipSeach {
        display: -webkit-box;
        display: -ms-flexbox;
        display: flex;
        -webkit-box-pack: justify;
        -ms-flex-pack: justify;
        justify-content: space-between;
        -webkit-box-align: center;
        -ms-flex-align: center;
        align-items: center;
        margin-bottom: 15px;
        padding-top: 5px;
    }
    .sheachBao {
        margin-top: 8px;
    }
    .sheachBao span {
        display: inline-block;
        margin-right: 10px;
        border-radius: 4px;
        font-size: 12px;
        color: #fff;
        padding: 0 5px;
        cursor: pointer;
        line-height: 24px;
    }
    .rightData .dataList span {
        padding-left: 10px;
        font-size: 14px;
        cursor: pointer;
    }
    .btn5{
        border:2px solid black;
    }
</style>
<div class="content pb0">
    <div class="workKey">
        <div style="text-align: left;padding-top: 15px">
            <button type="button" class="btn btn-default btn-sm" onclick="js.closeCurrentTabPage()" style="background: #FFF;border: 1px solid #DCDFE6;color: #606266;">${text('关 闭')}</button>
        </div>
        <div class="shipSeach">
            <div class="shipSeachEn">
                <p class="sheachBao" style="float: left">
                    <span style="background-color: #ff4d4d;" id="btn1" onclick="statuBtn('1','dataGrid','searchForm')">进度滞后</span>
                    <span style="background-color: #ff8b19;" id="btn2" onclick="statuBtn('2','dataGrid','searchForm')">逾期未反馈</span>
                    <span style="background-color: #4b87ff;" id="btn3" onclick="statuBtn('3','dataGrid','searchForm')">序时推进</span>
                    <span style="background-color: #1abd6e;" id="btn4" onclick="statuBtn('4','dataGrid','searchForm')">已完成</span>
                </p>
                <div style="float: right; margin-right: 16px">
                    <#form:form id="searchForm" model="${dcSupTaskAction}" action="${ctx}/home/homePage/queryChildList2" method="post" class="form-inline"
                    data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
                    <div style="">
                        <div class="form-group" style="float: left;margin-bottom:0px">
                            <div style="float: left">
                                <#form:input path="taskContent" class="form-control" placeholder="请输入关键字" />
                                <#form:hidden path="taskTitle"  value="${dcSupTaskAction.taskTitle}"/>
                                <#form:hidden path="taskLeader"  value="${dcSupTaskAction.taskLeader}"/>
                            </div>
                            <#form:input path="taskProgress" style="display:none"/>
                            <#form:input path="timeParam" style="display:none" value="${dcSupTaskAction.timeParam}"/>
                        </div>
                        <div class="form-group" style="float: left;margin-left: 10px;margin-bottom:0px">
                            <button type="submit" class="btn btn-primary btn-sm" style="background-color: #ffffff !important;color:#1e5edb">${text('查询')}</button>
                            <button type="reset" class="btn btn-default btn-sm" onclick="ret(1)" style="background: #FFF;border: 1px solid #DCDFE6;color: #606266;">${text('重置')}</button>
                        </div>
                    </div>
                </#form:form>
                </div>
            </div>
            <div class="rightData">
                <p class="dataList dataList1">
                    <span onclick="dataGet('1','dataGrid','searchForm')">本周</span>
                    <span onclick="dataGet('2','dataGrid','searchForm')">上周</span>
                    <span onclick="dataGet('3','dataGrid','searchForm')">本月</span>
                    <span onclick="dataGet('4','dataGrid','searchForm')">本季</span>
                    <span onclick="dataGet('5','dataGrid','searchForm')">本年</span>
                    <span   class="active" onclick="dataGet('','dataGrid','searchForm')">所有</span>
                </p>
            </div>
        </div>
        <table id="dataGrid"></table>
        <div id="dataGridPage"></div>
    </div>
</div>
<% } %>
<script src="${ctxStatic}/jquery/jquery-ui-sortable-1.12.1.min.js"></script>
<script src="${ctxStatic}/echarts/4.2/echarts.min.js"></script>
<script>
    if('${dcSupTaskAction.taskProgress}'==1){
        $('#btn1').addClass('btn5');
    }else if('${dcSupTaskAction.taskProgress}'==2){
        $('#btn2').addClass('btn5');
    }else if('${dcSupTaskAction.taskProgress}'==3){
        $('#btn3').addClass('btn5');
    }else if('${dcSupTaskAction.taskProgress}'==4){
        $('#btn4').addClass('btn5');
    }
    // 任务状态
    function statuBtn(taskStatus,dataId,formId){
        if(taskStatus==1){
            $('#btn1').addClass('btn5');$('#btn2').removeClass('btn5');
            $('#btn3').removeClass('btn5');$('#btn4').removeClass('btn5');
        }else if(taskStatus==2){
            $('#btn1').removeClass('btn5');$('#btn2').addClass('btn5');
            $('#btn3').removeClass('btn5');$('#btn4').removeClass('btn5');
        }else if(taskStatus==3){
            $('#btn1').removeClass('btn5');$('#btn2').removeClass('btn5');
            $('#btn3').addClass('btn5');$('#btn4').removeClass('btn5');
        }else if(taskStatus==4){
            $('#btn1').removeClass('btn5');$('#btn2').removeClass('btn5');
            $('#btn3').removeClass('btn5');$('#btn4').addClass('btn5');
        }
        $("#"+formId+ " #taskProgress").val(taskStatus)
        $('#'+dataId).dataGrid('reloadGrid');
    }
   //时间
   function dataGet(timeStatus,dataId,formId){
       $("#searchForm #timeParam").val(timeStatus)
       $('#'+dataId).dataGrid('reloadGrid');
   }

    //工作汇总
    $(function(){
        $(window).resize(function(){
            var footerHeight = $('.main-footer').outerHeight() || 0;
            var windowHeight = $(window).height();
            $('.content').css('min-height', windowHeight - footerHeight);
        }).resize();

        $('.ui-sortable').sortable({
            connectWith : '.ui-sortable',
            handle      : '.box-header, .nav-tabs',
            placeholder : 'sort-highlight',
            forcePlaceholderSize: true,
            zIndex : 999999
        }).find('.box-header, .nav-tabs').css('cursor', 'move');
    });

    // 重置
   function ret(value) {
     if(value == 1){
         searchForm.reset();
         $('#dataGrid').dataGrid('reloadGrid');
         $('.dataList1 span:last-child').addClass("active").siblings().removeClass("active");
     }
   }

    //日期切换
    $(".dataList span").click(function() {
        $(this).addClass("active").siblings().removeClass("active");
    })

    $(function(){
        var timePa = '${dcSupTaskAction.timeParam}'
        if(timePa){
        var html2 = $(".dataList span")[timePa-1]
        $(html2).addClass("active").siblings().removeClass("active");}
    })

    // 批示
    function clickTwo(id,taskLeader){
        js.layer.open({
            type: 2,
            title: ['领导批示'],
            area: ['800px', '400px'],
            scrollbar: true,
            shadeClose: false,
            content: "${ctx}/home/homePage/form?actionId="+id+"&explainCode="+taskLeader,
            btn1: function (index, layero) {
            },
            end:function () {
                $('#dataGrid').dataGrid('refresh', 1, 20);
            }
        });
    }
    // 初始化DataGrid对象
    $('#dataGrid').dataGrid({
        searchForm: $("#searchForm"),
        sortableColumn: false, // 列表不允许排序
        columnModel: [
            {header:'${text("主键")}', name:'id', index:'a.id', width:150, align:"left", hidden:true},
            {header:'${text("任务标题")}', name:'taskTitle', index:'a.task_title', width:150, align:"left",
                formatter: function(val, obj, row, act){
                    return '<a href="${ctx}/home/homePage/detailForm?taskId='+row.taskId+'&id='+row.id+'&taskLeader='+row.taskLeader+'" class="btnList" data-title="${text("任务详细")}">'+(val||'暂无标题')+'</a>';
                }},
            {header:'${text("任务内容")}', name:'taskContent', index:'a.task_content', width:150, align:"left"},
            {header:'${text("任务类型")}', name:'taskTypeName', index:'a.task_type_name', width:150, align:"center"},
            {header:'${text("牵头责任单位")}', name:'leaderOrgName', index:'a.leader_org_name', width:150, align:"center"},
            {header:'${text("任务进展")}', name:'taskProgress', index:'a.task_progress', width:150, align:"center", frozen:true, formatter: function(val, obj, row, act){
                    var taskSaF = row.taskProgress;
                    if (taskSaF == '2'){
                        return '<span>逾期未反馈</span>';
                    }else if(taskSaF =='3'){
                        return '<span>序时推进</span>';
                    }else if(taskSaF == '4'){
                        return '<span>已完成</span>';
                    }else if(taskSaF == '1'){
                        return '<span>进度滞后</span>';
                    }else if(taskSaF == '5'){
                        return '<span>未完成</span>';
                    }else{
                        return '<span>无</span>';
                    }
                }
            }
            // ,
            // {header:'${text("操作")}', name:'actions', width:120, align:"center",formatter: function(val, obj, row, act){
            //         var actions = [];
            //         if(row.explainContent == ''||row.explainContent ==null){
            //             actions.push('<a style="cursor:pointer;"  onclick=clickTwo("'+row.id+'","'+row.taskLeader+'")  title="${text("批示")}" ><span class="btn btn-primary btn-xs">批示</span></a>');
            //         } else {
            //             actions.push("<a href = 'javascript:js.alert(\""+row.explainContent+"\");'>查看</a>");
            //         }
            //         return actions.join('');
            //     }}
        ],
        ajaxSuccess: function(data){

        }
    });
</script>